<% @page_title = "#{h @group.title}小组 | 多背一公斤 - 灾后学校重建计划" -%>

<% content_for :sidebar do -%>
  <h2><%= link_to "写新话题", new_topic_url(@group.id) %></h2>
  <%= render :partial => "all_groups" %>
<% end -%>

<h1><%= h @group.title %>小组</h1>
<div class="bulletin">
  <%= @group.content_html %>
  
  <% if @group.editable_by?(current_user) -%>
    <p class="right"><%= link_to "修改", edit_group_url(@group.id) %></p>
  <% end -%>
</div>

<h2>最近的话题 &middot;&nbsp; &middot;&nbsp; &middot;&nbsp; &middot;&nbsp; &middot;&nbsp; &middot;&nbsp;</h2>
<table border="0" cellspacing="0" cellpadding="3" class="left ol" width="100%">
  <tr>
    <th>标题</th>
    <th>作者</th>
    <th align="right">总回复</th>
    <th align="right">最后回复</th>
  </tr>
  <% @topics.each do |topic| -%>
  <tr>
    <td width="40%"><%= link_to topic.title, topic_path(@group.id, topic.id) %></td>
    <td width="20%"><%= link_to topic.user.login, user_url(topic.user.id) %></td>
    <td class="tip" align="right"><%= topic.posts_count %></td>
    <td class="tip" width="30%" align="right">
      <% if topic.posts_count > 0 -%>
        <span class="tip"><%= topic.replied_by_user.login %>@<%= show_date topic.replied_at %></span>
      <% end -%>
    </td>
  </tr>
  <% end -%>
</table>
<%= will_paginate @topics %>
